package com.wellink.android_demo;

import android.os.Bundle;
import android.support.v7.app.AppCompatActivity;
import android.view.View;
import android.widget.ImageButton;
import android.widget.Toast;
import android.widget.ZoomButton;
import android.widget.ZoomControls;

/**
 * Created by veikin on 2018/5/10.
 */

public class ImageButtonActivity extends AppCompatActivity {
    private ImageButton btn = null;
    private boolean flag = true;

    private ZoomControls zc = null;
    private ZoomButton zb0 = null;
    private ZoomButton zb1 = null;

    @Override
    protected void onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
        setContentView(R.layout.imgbtn_layout);

        btn = findViewById(R.id.imgbtn_play);

        btn.setOnClickListener(new View.OnClickListener() {
            @Override
            public void onClick(View v) {
                if(flag){
                    Toast.makeText(ImageButtonActivity.this,"Playing....",Toast.LENGTH_LONG).show();
                    btn.setImageResource(R.drawable.stop);
                    flag = false;
                }else{
                    Toast.makeText(ImageButtonActivity.this,"Stop Now",Toast.LENGTH_LONG).show();
                    btn.setImageResource(R.drawable.play);
                    flag = true;
                }
            }
        });

        zc = findViewById(R.id.zc);
        zb0 = findViewById(R.id.minus_zb);
        zb1 = findViewById(R.id.plus_zb);

        zc.setOnZoomInClickListener(new View.OnClickListener() {
            @Override
            public void onClick(View v) {
                Toast.makeText(ImageButtonActivity.this,"放大",Toast.LENGTH_SHORT).show();
            }
        });

        zc.setOnZoomOutClickListener(new View.OnClickListener() {
            @Override
            public void onClick(View v) {
                Toast.makeText(ImageButtonActivity.this,"缩小",Toast.LENGTH_SHORT).show();
            }
        });

        zb1.setOnClickListener(new View.OnClickListener() {
            @Override
            public void onClick(View v) {
                Toast.makeText(ImageButtonActivity.this,"fangda",Toast.LENGTH_SHORT).show();
            }
        });

        zb0.setOnClickListener(new View.OnClickListener() {
            @Override
            public void onClick(View v) {
                Toast.makeText(ImageButtonActivity.this,"suoxiao",Toast.LENGTH_SHORT).show();
            }
        });
    }

}
